package com.kaifamiao.contraller;

import com.kaifamiao.util.ResponseUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

@RestController
public class FileUploadController {

    @PostMapping("/upload")
    public ResponseUtil upload(Integer id, MultipartFile multipartFile, MultipartHttpServletRequest request){
//        try {
//            multipartFile.transferTo(new File("d:/mei.jpg"));
//            System.out.println(id);
//            return new ResponseUtils(1, "上传成功", null);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        return new ResponseUtil(0, "上传失败", null);
    }

}
